<template>
	<view class="page" :style="themeColor">
		<view
			class="flex flex-direction flex-wrap align-stretch justify-center benben-position-layout flex yesPayPassword_flex_0"
			:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx'}">
			<view class='flex flex-wrap align-stretch justify-between yesPayPassword_fd0_0'>
				<view class='flex flex-wrap align-center yesPayPassword_fd0_0_c0'>
					<person></person>
				</view>
				<view class='flex flex-wrap align-center'>
					<text style="font-size: 36rpx;font-weight: 500;">旧密码验证</text>
				</view>
				<view class='flex align-center justify-end yesPayPassword_fd0_0_c2'>
				</view>
			</view>

		</view>
		<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
		<view style="padding: 8rpx 32rpx;">
			<back></back>
		</view>
		<!---修改支付密码第二步flex布局开始-->
		<view class="flex flex-direction flex-wrap align-center benben-flex-layout">
			<view class='flex flex-wrap align-center yesPayPassword_fd1_0'>
				<text class='yesPayPassword_fd1_0_c0'>1</text>
				<view class='flex flex-wrap align-center yesPayPassword_fd1_0_c1'>
				</view>
				<text class='yesPayPassword_fd1_0_c0'>2</text>
				<view class='flex flex-wrap align-center yesPayPassword_fd1_0_c1'>
				</view>
				<text class='yesPayPassword_fd1_0_c4'>3</text>
			</view>
			<text class='yesPayPassword_fd1_1'>设置支付密码</text>
			<text class='yesPayPassword_fd1_2'>请再次输入新支付密码</text>
		</view>

		<!---修改支付密码第二步flex布局结束-->
		<benben-digital-password v-model='pwd' @confirm="checkCodeFunc()" :box-num='6' mode='password'
			class-name='flex flex align-center justify-center yesPayPassword_flex_password_2'>
			<template #default="{ content, active, index }">
				<view :key="index" v-if="active"
					class="flex align-center justify-center active-digital-password yesPayPassword_flex_password_active_2">
					{{ content }}
				</view>
				<view :key="index" v-else
					class="flex align-center justify-center yesPayPassword_flex_password_active_2">
					{{ content }}
				</view>
			</template>
		</benben-digital-password>
		<!---flex布局flex布局开始-->
		<view class="flex flex-wrap align-center justify-center benben-flex-layout yesPayPassword_flex_3">
			<text class='yesPayPassword_fd3_0'>支付密码为6位数字，用户提现、设置密保、添加银行卡等
				操作，可保障资金安全</text>
		</view>

		<!---flex布局flex布局结束-->


	</view>
</template>
<script>
	import {
		validate
	} from '@/common/utils/validate.js'
	import back from "@/components/back/index.vue"
	import person from "@/components/person/index.vue"
	export default {
		components: {
			back,
			person
		},


		data() {
			return {
				"pwd": "",
				"type": "",
				"oldPayPwd": ""
			};
		},
		computed: {
			themeColor() {
				return this.$store.getters.themeColor
			},

		},
		watch: {},
		onLoad(options) {
			let {
				type,
				oldPayPwd
			} = options
			if (type !== undefined) this.type = type
			if (oldPayPwd !== undefined) this.oldPayPwd = oldPayPwd
		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {

		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			//校验验证码
			async checkCodeFunc() {
				if (!(this.oldPayPwd == this.pwd)) {
					this.$message.info('两次密码不一致');
					return false;
				}
				let res = await this.$api.post(global.apiUrls.a6472191a92a6b, {
					pay_password: this.oldPayPwd,
					pay_password_code: this.pwd
				})
				if (res.data.code != 1) {
					this.$message.info(res.data.msg)
					return
				}
				this.$message.info(res.data.msg)
				setTimeout(() => {
					uni.redirectTo({
						url: '/pages/xtsz/payChange/payChange'
					})
				}, 600)
			}
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: #fff;
		background-size: 100% auto !important;
	}

	.yesPayPassword_flex_0 {
		background: #fff;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.yesPayPassword_fd0_0_c2 {
		padding: 0rpx 0rpx 0rpx 0rpx;
		width: 100rpx;
	}

	.yesPayPassword_fd0_0_c0_c0 {
		font-size: 36rpx;
		font-weight: 400;
		color: #333;
	}

	.yesPayPassword_fd0_0_c0 {
		width: 100rpx;
	}

	.yesPayPassword_fd0_0 {
		padding: 0rpx 32rpx 0rpx 32rpx;
		line-height: 88rpx;
	}

	.yesPayPassword_fd1_2 {
		line-height: 36rpx;
		font-size: 24rpx;
		font-weight: 400;
		color: #333333;
		margin: 40rpx 0rpx 0rpx 0rpx;
	}

	.yesPayPassword_fd1_1 {
		font-size: 36rpx;
		font-weight: 500;
		color: #333333;
		margin: 64rpx 0rpx 0rpx 0rpx;
	}

	.yesPayPassword_fd1_0_c4 {
		background: #6A0002;
		line-height: 36rpx;
		font-size: 32rpx;
		font-weight: 500;
		color: var(--benbenFontColor3);
		border-radius: 50%;
		background-size: 100% auto !important;
		padding: 8rpx 16rpx 8rpx 16rpx;
	}

	.yesPayPassword_fd1_0_c1 {
		background: var(--benbenbgColor2);
		width: 118rpx;
		height: 4rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
	}

	.yesPayPassword_fd1_0_c0 {
		background: #6A0002;
		line-height: 36rpx;
		font-size: 32rpx;
		font-weight: 500;
		color: #FFFFFF;
		border-radius: 50%;
		background-size: 100% auto !important;
		padding: 8rpx 16rpx 8rpx 16rpx;
	}

	.yesPayPassword_fd1_0 {
		margin: 143rpx 0rpx 0rpx 0rpx;
	}

	.yesPayPassword_flex_password_active_2 {
		border: 1px solid rgba(217, 217, 217, 1);
		width: 100rpx;
		height: 100rpx;
	}

	::v-deep .yesPayPassword_flex_password_2 {
		margin: 24rpx 0rpx 24rpx 0rpx;
	}

	.yesPayPassword_flex_3 {
		padding: 0rpx 68rpx 0rpx 68rpx;
	}

	.yesPayPassword_fd3_0 {
		text-align: center;
		line-height: 36rpx;
		font-size: 24rpx;
		font-weight: 400;
		color: #999999;
	}
</style>